﻿using IntelligentGateway.SmartCommunity.BUS;
using IntelligentGateway.SmartCommunity.DevicePlatform;
using IntelligentGateway.SmartCommunity.Server;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using IntelligentGateway.SmartCommunity.Model;
using IntelligentGateway.SmartCommunity.DAL;
using System.IO.Pipelines;
using IntelligentGateway.Services;

namespace IntelligentGateway.SmartCommunity.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class AuthorizeController : ControllerBase
    {
        public AuthorizeController()
        {
        }

        /// <summary>
        /// Test
        /// </summary>
        /// <returns>success</returns>
        [HttpPost]
        [Route("Test")]
        public ResponseMessage Test()
        {
            ResponseMessage message = new ResponseMessage();
            try
            {
                byte[] bytes = new byte[] { 0x00, 0x8B, 0x00, 0x00, 0x00, 0x1B, 0x01, 0x10, 0x00, 0x19, 0x00, 0x0A, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

                //byte[] bytes = new byte[] { 0x00, 0x8B, 0x00, 0x00, 0x00, 0x09, 0x00, 0x10, 0x00, 0x37, 0x00, 0x01, 0x02, 0x00, 0x02 };
                IGTCPServerMessageProcess.QRCodeProcess(bytes);
                message.errcode = 0;
            }
            catch
            {
                message.errcode = 1;
                message.errmsg = "设备查询异常";
            }

            return message;
        }
    }
}
